package sunstar.com.xq.presenter

import android.app.Activity
import android.content.Context
import sunstar.com.xq.databean.PublicStaticBean
import sunstar.com.xq.util.Preference
import sunstar.com.xq.view.MySelfFragmentView

/**
 * Created by Sun.Star on 2017/6/20.
 */
class CheckLoginPresenter(var mySelfFragmentView: MySelfFragmentView) {
    fun checkLogin(context: Context,clazz: Activity){
        var userDataString : String by Preference(context,"userData","")
        if(userDataString.equals("")){
            mySelfFragmentView.notLogin()
        }else{
            mySelfFragmentView.login(clazz)
        }
    }
    fun checkLoginData(context: Context){
        var userDataString : String by Preference(context,"userData","")
        if(userDataString.equals("")){
            mySelfFragmentView.noData()
        }else{
            mySelfFragmentView.loadUserData(PublicStaticBean.getUser(context))
        }
    }
}